home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / pdftops / xpdf / h / PSOutput < prev    next >
Text File  |  1996-06-08  |  2KB  |  70 lines

  1. //========================================================================
  2. //
  3. // PSOutput.h
  4. //
  5. // Copyright 1996 Derek B. Noonburg
  6. //
  7. //========================================================================
  8.  
  9. #ifndef PSOUTPUT_H
  10. #define PSOUTPUT_H
  11.  
  12. #ifdef __GNUC__
  13. //#pragma interface
  14. #endif
  15.  
  16. #include <stdio.h>
  17. #include "gtypes.h"
  18.  
  19. class Catalog;
  20. class GfxFont;
  21.  
  22. //------------------------------------------------------------------------
  23. // PSOutput
  24. //------------------------------------------------------------------------
  25.  
  26. class PSOutput {
  27. public:
  28.  
  29.   // Open a PostScript output file, and write the prolog.
  30.   PSOutput(char *fileName, Catalog *catalog,
  31.        int firstPage, int lastPage);
  32.  
  33.   // Write the trailer and close the file.
  34.   ~PSOutput();
  35.  
  36.   // Check if file was successfully created.
  37.   GBool isOk() { return ok; }
  38.  
  39.   // Start a page.
  40.   void startPage(int pageNum, int x1, int y1, int x2, int y2);
  41.  
  42.   // End a page.
  43.   void endPage();
  44.  
  45.   // Write trailer at end of file.
  46.   void trailer();
  47.  
  48.   // Write PostScript code to file.  Uses printf format.
  49.   void writePS(char *fmt, ...);
  50.  
  51.   // Write a string to the file, using escape chars as necessary.
  52.   void writePSString(GString *s);
  53.  
  54.   // Write an image to file, given its defining dictionary and
  55.   // data stream.
  56.   void writeImage(Dict *dict, Stream *str, GBool inlineImg);
  57.  
  58. private:
  59.  
  60.   void writeStream(Stream *str, GBool inlineImg, GBool needA85);
  61.  
  62.   FILE *f;            // PostScript file
  63.   int seqPage;            // current sequential page number
  64.   GBool ok;            // set up ok?
  65.  
  66.   void setupFont(GfxFont *font);
  67. };
  68.  
  69. #endif
  70.